﻿using System;
using System.Windows.Data;

namespace AnthStat.WPF.Applications.Converters
{
    public sealed class DaysToMonthsConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            // TODO: Code contracts

            double days = (double)value;

            double months = days / 30.4368499;

            return months;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            // TODO: Code contracts

            double months = System.Convert.ToDouble(value);

            double days = months * 30.4368499;

            return days;
        }
    }
}
